import java.util.Scanner;

public class number {
    //数字加密
    //需求：
    //某系统的数字密码（大于0)，比如1983，采用加密方式进行传输。规则如下：
    //先得到每位数，然后每位数都加上5，再对10求余，最后将所有数字反转，得到一串新数
    public static void main(String[] args) {

        //得到需要加密的数字
        int number = getNumber(9);
        //得到加密数字的每位数
        int[] wei = getWei(number);
        for (int i = 0; i < wei.length; i++) {
            System.out.print(wei[i]);
        }
        //每位数加5
        for (int i = 0; i < wei.length; i++) {
            wei[i] += 5;
        }
        //每位数对10取余
        for (int i = 0; i < wei.length; i++) {
            wei[i] = wei[i] % 10;
        }
        //将数值翻转
        for (int i = 0; i < wei.length; i++) {
            System.out.print(wei[i]);
        }
    }

    public static int getNumber(int originNumber) {
        boolean a = true;
        while (a) {
            System.out.println("请输入需要加密的数字:" + "(大于0)");
            Scanner sc = new Scanner(System.in);
            int flag = sc.nextInt();
            if (flag > 0) {
                originNumber = flag;
                a = false;
            } else {
                System.out.println("输的什么逼玩意,重输");
            }
        }
        return originNumber;
    }

    public static int[] getWei(int number) {
        int wei = 0;
        int flag = 0;
        int temp = number;
        boolean b = true;
        while (b) {
            flag++;
            number = number / 10;
            if (number == 0) {
                b = false;
            }
        }
        int[] weiNumber = new int[flag];
        for (int i = 0; i < flag; i++) {
            weiNumber[i] = temp % 10;
            temp = temp / 10;
        }
        return weiNumber;
    }


}
